package com.yuand.config;

import com.yuand.entity.SysUser;

/**
 * @author yuandong
 * @date 2021/9/22 14:48
 *
 * 将用户信息保存到ThreadLocal中
 */
public class UserThreadLocal {

    private UserThreadLocal(){}

    private static final ThreadLocal<SysUser> LOCAL = new ThreadLocal<>();

    public static void put(SysUser sysUser){
        LOCAL.set(sysUser);
    }

    public static SysUser get(){
        return LOCAL.get();
    }

    public static void remove(){
        LOCAL.remove();
    }
}
